package nii.game.mobileserio.action_game;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class SplashScene extends Activity
{
	
	protected boolean _active = true;
	protected int _splashTime = 2000; // Thời gian dừng splash scene
	
	//==========================|| onCreate Function ||===========================//
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		
		setContentView(R.layout.splash);
		
		Thread splashTread = new Thread() {
	        public void run() 
	        {
	            try {
	                int waited = 0;
	                while(_active && (waited < _splashTime)) 
	                {
	                    sleep(100);
	                    if(_active) waited += 100;
	                }
	            } 
	            catch(InterruptedException e) {
	                // do nothing
	            } 
	            finally {
	                finish();
	                startActivity(new Intent(SplashScene.this, MenuActivity.class));
	                stop();
	            }
	        }
	    };
	    splashTread.start();
	}
		
}
